<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateForumCategoriesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('forum_categories', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('pid')->comment('父类板块');
            $table->string('path')->index()->comment('板块id导航');

            $table->string('name')->index()->comment('板块名称');
            $table->text('description')->nullable()->comment('板块描述');
            $table->integer('post_count')->default(0)->comment('帖子数');

            $table->string('icon')->nullable()->comment('图标');
            $table->smallInteger('displayorder')->nullable()->comment('显示顺序');
            $table->tinyInteger('modnewposts')->default(0)->comment('该板块发帖是否需要审核');

            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('forum_categories');
    }
}
